package com.bonc.ioc.demo.feign;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author LENOVO
 */
//url=http://127.0.0.1:8763/downloadFile?id=4
@FeignClient(name = "mcp-file",url = "http://127.0.0.1:8763")
public interface FileFeignClient{
    /**
     * 上传文件
     * @param file
     * @param project
     * @return
     */
    @PostMapping(value = "/upload",produces = {MediaType.APPLICATION_JSON_UTF8_VALUE},consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    void uploadFile(@RequestPart("file") MultipartFile file,@RequestParam("project") String project);

    /**
     * 下载文件
     * @param id
     * @return
     */
    @GetMapping(value = "/downloadFile")
    String downloadFile(@RequestParam("id") int id);
}